<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        li{
            width: 200px;
        }
    </style>
</head>
<body>
<ul>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
</ul>
<script type="text/javascript">
    var aLi = document.getElementsByTagName('li');
    for(var i=0;i<aLi.length;i++){
        if (i%2==0){
            aLi[i].style.background="#ccc"
        }
        else {
            aLi[i].style.background=""
        }
    }
</script>
</body>
</html>